﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;

namespace QuanLyKho.Report
{
    public partial class rptTonKho : DevExpress.XtraReports.UI.XtraReport
    {
        int stt;
        public rptTonKho()
        {
            InitializeComponent();
        }

        public void BindHeader(DateTime tuNgay, DateTime denNgay)
        {
            xrTuNgayDenNgay.Text = String.Format("Từ ngày {0} đến ngày {1}", tuNgay.Date.ToString("dd/MM/yyyy"), denNgay.Date.ToString("dd/MM/yyyy"));
        }

        public void BindDetails()
        {
            xrTenThuocHamLuong.DataBindings.Add("Text", DataSource, "TenThuocHamLuong");
            xrTenDonViTinh.DataBindings.Add("Text", DataSource, "TenDonViTinh");
            xrSoLo.DataBindings.Add("Text", DataSource, "SoLo");
            //xrGiaNhap.DataBindings.Add("Text", DataSource, "GiaNhap", "{0:#,##0}");
            //xrGiaXuat.DataBindings.Add("Text", DataSource, "GiaXuat", "{0:#,##0}");
            xrSLTonDauKy.DataBindings.Add("Text", DataSource, "SLTonDauKy");
            xrTTTonDauKy.DataBindings.Add("Text", DataSource, "TTTonDauKy", "{0:#,##0}");
            xrSLNhapTrongKy.DataBindings.Add("Text", DataSource, "SLNhapTrongKy");
            xrTTNhapTrongKy.DataBindings.Add("Text", DataSource, "TTNhapTrongKy", "{0:#,##0}");
            //xrTTTongCongDauKy.DataBindings.Add("Text", DataSource, "SLTongCongDauKy");
            //xrTTTongCongDauKy.DataBindings.Add("Text", DataSource, "TTTongCongDauKy", "{0:#,##0}");
            xrSLXuatTrongKy.DataBindings.Add("Text", DataSource, "SLXuatTrongKy");
            xrTTXuatTrongKy.DataBindings.Add("Text", DataSource, "TTXuatTrongKy", "{0:#,##0}");
            xrTTXuatVon.DataBindings.Add("Text", DataSource, "TTXuatVon", "{0:#,##0}");
            xrSLTonCuoiKy.DataBindings.Add("Text", DataSource, "SLTonCuoiKy");
            xrTTTonCuoiKy.DataBindings.Add("Text", DataSource, "TTTonCuoiKy", "{0:#,##0}");
        }

        private void Detail_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            stt++;
            xrSTT.Text = stt.ToString();
        }
    }
}
